﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ValiVIN;
using System.Diagnostics;

namespace VINTester
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            txtVIN.KeyUp += new KeyEventHandler(txtVIN_KeyUp);
        }

        void txtVIN_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                btnValidate_Click(this, new EventArgs());
            }
        }

        private void btnValidate_Click(object sender, EventArgs e)
        {
            Stopwatch t = new Stopwatch();
            t.Start();
            VINumber myVIN = txtVIN.Text.Trim();
            t.Stop();
            txtDetails.Text = myVIN.ToString() + System.Environment.NewLine + "(" + t.ElapsedMilliseconds + " ms)";
        }
    }
}
